package com.yict.common.entity;


/**
 * 
 * 
 * @author Patrick.Deng
 * 
 */
public class PageEntity {

	/**
	 * 当前页码
	 */
	private int curPage = 1;

	/**
	 * 设置每页显示的页数
	 */
	private int pageSize = 15;

	/**
	 * 跳转页数
	 */
	private int toPage = 1;

	/**
	 * 总页数
	 */
	private int totalPage;

	/**
	 * 记录总数
	 */
	private int totalRecord;

	/**
	 * 查询开始位
	 */
	private int startNm = -1;

	/**
	 * EntityName
	 */
	private String tableName;

	/**
	 * 排序字段
	 */
	private String field = "";

	/**
	 * 排序规则
	 */
	private String order = "";

	public int getCurPage() {
		return curPage;
	}

	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalPage() {
		if (this.totalRecord % this.pageSize == 0) {
			totalPage = this.totalRecord / this.pageSize;
		} else {
			totalPage = this.totalRecord / this.pageSize + 1;
		}
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
	}

	public int getToPage() {
		return toPage;
	}

	public void setToPage(int toPage) {
		if (toPage < 1) {
			toPage = 1;
		}
		this.toPage = toPage;
	}

	public int getStartNm() {
		if (toPage == 1) {
			startNm = 0;
		} else {
			startNm = (toPage - 1) * pageSize;
		}
		return startNm;
	}

	public void setStartNm(int startNm) {
		this.startNm = startNm;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

}
